package com.apes.fn.ssm.service;

import com.apes.fn.ssm.repository.CalculateProductRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.util.Map;

@Service("calculateProductService")
public class CalculateProductService extends DomainService {

    @Autowired
    CalculateProductRepository calculateProductRepository;

    public void saveCalcuCondiData(Map condi) {
        String state = ObjectUtils.isEmpty(condi.get("STATE"))?"":condi.get("STATE").toString();
        calculateProductRepository.exec(" INSERT INTO MAS_GET_PRODUCT_SQL(BRAND_ID, STATE, FITTING_MESSAGE_ID, LOCATION_ID) " +
                " VALUES('"+ condi.get("BRAND_ID") +"', '"+ state +"', '"+ condi.get("FITTING_MESSAGE_ID") +"', '"+ condi.get("LOCATION_ID") +"') ");
    }
}
